﻿using System.Collections.Generic;

namespace Raven
{
    public class EntityManager
    {
        private Dictionary<int, BaseGameEntity> _entityMap = new Dictionary<int, BaseGameEntity>();

        public EntityManager()
        {
        }

        public void Reset()
        {
            _entityMap.Clear();
        }

        public void RegisterEntity(BaseGameEntity newEntity)
        {
            _entityMap.Add(newEntity.ID(), newEntity);
        }

        public BaseGameEntity GetEntityFromID(int id)
        {
            Utility.Assert(_entityMap.ContainsKey(id), "<EntityManager::GetEntityFromID>: invalid ID");
            return _entityMap[id];
        }

        public void RemoveEntity(BaseGameEntity e)
        {
            _entityMap.Remove(e.ID());
        }
    }
}